package codeRose.mapper;

import java.util.Date;
import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import codeRose.domain.Customer;
import codeRose.domain.Goods;
import codeRose.domain.Worker;




public interface UserMapper {
	//用户登录
	@Select("select * from customer where name=#{name} and password=#{password} and identify=#{identify}")
    Customer findWithLoginAndPassword(@Param("name")String name,@Param("password")String password,@Param("identify")String identify);
	//注册
	@Insert("insert into customer(name,password,nickname,email,sex,address,phone) values(#{param1},#{param2},#{param3},#{param4},#{param5},#{param6},#{param7})")
	int insert(String name,String password,String nickname,String email,String sex,String address,String phone);
   	//浏览商城所有商品
	@Select("select * from goods")
	List<Goods> listGoods();
	//管理员
	@Select("select * from worker where name=#{name} and password=#{password} and identify=#{identify}")
    Worker ManagerLogin(@Param("name")String name,@Param("password")String password,@Param("identify")String identify);
	//添加商品(加货1)
	@Insert("insert into goods(name,price,type,discount,createtime,limittime,productby,size,pic,number) values(#{param1},#{param2},#{param3},#{param4},#{param5},#{param6},#{param7},#{param8},#{param9},#{param10})")
	int addGoods(String name,Integer price,String type,String discount,String createtime,String limittime,String productby,String size,String pic,Integer number);
	//确认添加(上架)
	@Update("update goods set look=1 where id=#{id}")
	int confirm(@Param("id")Integer id);
}